<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    html,
    body,
    #root {
      margin: 0;
      height: 100%;
      font-family: "Helvetica Neue", Arial, sans-serif;
      color: #333;
     
    }

    textarea,
    #root div {
      display: inline-block;
      width: 49%;
      height: 100%;
      vertical-align: top;
      box-sizing: border-box;
      padding: 0 20px;
    }
    textarea {
      border: none;
      border-right: 1px solid #ccc;
      resize: none;
      outline: none;
      background-color: #f6f6f6;
      font-size: 14px;
      font-family: "Monaco", courier, monospace;
      padding: 20px;
      background-image: url("./img/1.png");
      background-repeat: no-repeat;
      background-position: 50% 50%;
      background-size:50%;
    }
    code {
      color: #f66;
    }
    </style>
<body>
    <div id="root">
        <textarea :value="input" @input="updateFn"></textarea>
        <div v-html="amarkdown"></div>
    </div>
</body>
</html>
<script src="http://unpkg.zhimg.com/vue@2"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/marked/1.2.7/marked.min.js"></script>
<script>
const vm = new Vue({
 el: "#root",
 data: {
    input: "# hello"
},
computed: {
    amarkdown: function () {
        return marked(this.input);
    }
},
 methods: {
    updateFn(e) {
        // console.log(this);
        this.input = e.target.value;
    }
 },
 
})
</script>